#pragma once

#include "../umlmodel_global.h"

#include <memory>
#include <vector>

#include "NamedElement.h"
#include "Vertex.h"

using std::make_shared;
using std::shared_ptr;
using std::vector;

namespace uml {
class Pseudostate;
class State;

/// <summary>
/// ConnectionPointReference
/// A ConnectionPointReference represents a usage (as part of a submachine State) of
/// an entry/exit point Pseudostate defined in the StateMachine referenced by the
/// submachine State.
/// </summary>
class UMLMODEL_EXPORT ConnectionPointReference : public NamedElement, public Vertex {

public: // Constructors and destructors
    explicit ConnectionPointReference(const QString& umlType="uml::ConnectionPointReference");

public: // JsonSerializable override
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    void toJson(QJsonObject& json) override;

public: // Properties
    /// <summary>
    /// entrys getter
    /// The entryPoint Pseudostates corresponding to this connection point.
    /// </summary>
    vector<shared_ptr<Pseudostate>>& entrys();

    /// <summary>
    /// exits getter
    /// The exitPoints kind Pseudostates corresponding to this connection point.
    /// </summary>
    vector<shared_ptr<Pseudostate>>& exits();

    /// <summary>
    /// state getter
    /// The State in which the ConnectionPointReference is defined.
    /// </summary>
    shared_ptr<State> state() const;

    /// <summary>
    /// state setter
    /// The State in which the ConnectionPointReference is defined.
    /// </summary>
    void setState(shared_ptr<State> value);

private: // Fields
    /// <summary>
    /// entrys
    /// The entryPoint Pseudostates corresponding to this connection point.
    /// </summary>
    vector<shared_ptr<Pseudostate>> entrys_;

    /// <summary>
    /// exits
    /// The exitPoints kind Pseudostates corresponding to this connection point.
    /// </summary>
    vector<shared_ptr<Pseudostate>> exits_;

    /// <summary>
    /// state
    /// The State in which the ConnectionPointReference is defined.
    /// </summary>
    shared_ptr<State> state_;

};

} // namespace uml
